package com.example.yyjc.service.impl;

import com.example.yyjc.domain.selectionanalyze.CountrySecondCatCase;
import com.example.yyjc.domain.selectionanalyze.SecondCatGoodsTopTen;
import com.example.yyjc.domain.selectionanalyze.SecondCatShopTopTen;
import com.example.yyjc.mapper.SelectionMapper;
import com.example.yyjc.service.SelectionService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @ClassName SelectionServiceImpl
 * @Description TODO
 * @Author lvyongwei
 * @Date 2020-12-1 10:37
 **/
@Service
public class SelectionServiceImpl implements SelectionService {

    @Autowired
    private SelectionMapper selectionMapper;

    /**
     * 获取所有日期 升序
     *
     * @param beginTime
     * @param endTime
     * @return
     */
    @Override
    public List<String> getAllTimeAsc(String beginTime, String endTime) {
        return selectionMapper.getAllTimeAsc(beginTime, endTime);
    }

    /**
     * 获取国家全部月份下的二级类目的规模趋势
     * @param countryName
     * @param firstCatId
     * @return
     */
    @Override
    public List<CountrySecondCatCase> getSecondCatScale(String countryName, Integer firstCatId, String beginTime, String endTime) {
        return selectionMapper.getSecondCatScale(countryName, firstCatId, beginTime, endTime);
    }


    /**
     * 获取某国家下一级类目下二级类目名称
     * @param firstCatId
     * @param countryName
     * @return
     */
    @Override
    public List<String> getSecondCatName(Integer firstCatId, String countryName) {
        return selectionMapper.getSecondCatName(firstCatId, countryName);
    }

    /**
     * 获取国家各个月份一级目录下二级目录的销售额
     * @param times
     * @param countryName
     * @param secondCatName
     * @return
     */
    @Override
    public List<Double> getSecondCatSaleRoom(List<String> times, String countryName, String secondCatName) {
        return selectionMapper.getSecondCatSaleRoom(times, countryName, secondCatName);
    }

    /**
     * 根据二级类目获取top100店铺集中度
     *
     * @param time
     * @param secondCatTitleId
     * @return
     */
    @Override
    public List<SecondCatShopTopTen> getSecondCatShops(String time, Integer secondCatTitleId) {
        return selectionMapper.getSecondCatShops(time, secondCatTitleId);
    }

    /**
     * 求所有销售总额
     *
     * @param time
     * @param secondCatTitleId
     */
    @Override
    public double getSecondCatShopsSaleRoom(String time, Integer secondCatTitleId) {
        return selectionMapper.getSecondCatShopsSaleRoom(time,secondCatTitleId);
    }

    /**
     * 获取某个国家二级类目的top
     * @param time
     * @param countryName
     * @param secondCatTitleId
     * @return
     */
    @Override
    public List<SecondCatShopTopTen> getSecondCatShopTop(String time, String countryName, Integer secondCatTitleId) {
        return selectionMapper.getSecondCatShopTop(time, countryName, secondCatTitleId);
    }


    /**
     * 获取二级类目某个月份所有商品价格
     * @param time
     * @param secondCatTitleId
     * @return
     */
    @Override
    public List<SecondCatGoodsTopTen> getAllGoodTop(String time, Integer secondCatTitleId) {
        return selectionMapper.getAllGoodTop(time, secondCatTitleId);
    }


    /**
     * 获取某个二级类目top1国家(物流分析/商品物流分析/销量TOP10国家的各国家TOP3物流渠道)
     * @param time
     * @param secondCatTitleId
     * @return
     */
    @Override
    public String getCountryName(String time, Integer secondCatTitleId) {
        return selectionMapper.getCountryName(time,secondCatTitleId);
    }


    /**
     * 获取第一国家的top3物流及数据
     * @param time
     * @param secondCatTitleId
     * @param countryName
     * @return
     */
    @Override
    public List<Map<String, Double>> getTopThreeCount(String time, Integer secondCatTitleId, String countryName) {
        return selectionMapper.getTopThreeCount(time, secondCatTitleId, countryName);
    }
}
